<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ page import="org.apache.shiro.authc.ExcessiveAttemptsException"%>
<%@ page import="org.apache.shiro.authc.IncorrectCredentialsException"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	response.setHeader("Set-Cookie", "name=xsbd; HttpOnly");
%>
<%
	response.setHeader("Set-Cookie", "name=ssiid; Secure");
%>
<!DOCTYPE html>
<head>
<title>设备监控管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Cache-Control" content="no-cache" />
<link href="css/login.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="js/jquery.min.js"></script>
<script src="js/DateConvertUtil.js"></script>
<script src="js/jquery.easyui.min.js"></script>
<link href="js/themes/bootstrap/easyui.css" rel="stylesheet" />
<link href="js/themes/icon.css" rel="stylesheet" />
<script src="js/common.js"></script>
<script type="text/javascript" language="javascript">
	/* $(document)
			.ready(
					function() {
						$('#userpasswd')[0].onkeypress = function(event) {
							var e = event || window.event, $tip = $('#capslock'), kc = e.keyCode
									|| e.which, // 按键的keyCode
							isShift = e.shiftKey || (kc == 16) || false; // shift键是否按住
							if (((kc >= 65 && kc <= 90) && !isShift)
									|| ((kc >= 97 && kc <= 122) && isShift)) {
								$tip.show();
							} else {
								$tip.hide();
							}
						};
					}); */
$(function(){
	

	//判断账号输入格式
	$('#log_username').validatebox({
		required : true,
		validateOnBlur : true,
		validType : 'length[5,12]',
		missingMessage : '请输入账号',
		invalidMessage : '输入无效，请输入长度为 大于等于6位 少于等于12位的密码'
	})
	//判断密码输入格式
	$('#log_userpasswd').validatebox({
		required : true,
		validateOnBlur : true,
		validType : 'length[5,20]',
		missingMessage : '请输入密码',
		invalidMessage : '输入无效，请输入长度为 大于等于8位 少于等于20位的密码'
	})
});
function sub() {
	var flag;
	flag = $('#log_username').validatebox("isValid");
	flag = $('#log_userpasswd').validatebox("isValid");
	
	if(flag){
		$('#myform').submit();
	}
}
</script>
<style type="text/css">
.noBut {
	background-color: #CCCCCC;
}
</style>
</head>
<body class="login_wp">
	<div class="login_wp">
		<div class="bj_hover"></div>
		<div class="loginPage">
			<div class="loginBox rmtS">
				<form name="myform" id="myform" action="submitLogin.do" method="post">
					<div class="loginList">
						<div class="loginListRow">
							<input placeholder="用户名" id="log_username" name="username"
								value="${username}" class="inputText inputBlock focus" type="text" validType="loginName">
						</div>
						<div class="loginListRow">
							<div id="capslock" class="zimutishi" style="display: none">
								<i></i>大写键盘已开启，请注意大小写!
							</div>
							<input placeholder="密码" name="userpasswd" id="log_userpasswd"
								class="inputText inputBlock" class="passwd" type="password" 
								validType="capsLockTip" autocomplete="off">
						</div>
						<div>
								<c:if test="${shiroLoginFailure eq 'unknownUserError' || shiroLoginFailure eq 'userOrPasswdError'}">
									<div class="error-msg prepend-top">账号密码错误</div>
								</c:if>
						</div>
						<input style="display: none;" type="submit">

						<div class="pt20">
							<a href="javascript:void(0);" onclick="sub()" role="submitBtn"
								class="btn block blue">登 录</a>
						</div>

					</div>
				</form>
			</div>
			<div class="footer">
				<p>设备监控管理系统</p>
			</div>
		</div>
	</div>
</body>
</html>